//
//  HeadView.m
//  HimalayaMusic
//
//  Created by dllo on 16/1/13.
//  Copyright © 2016年 WXCLegendary. All rights reserved.
//

#import "HeadView.h"

@implementation HeadView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        [self addSubview:_backButton];
        [_backButton setBackgroundImage:[UIImage imageNamed:@"fanhui"] forState:UIControlStateNormal];
        [_backButton addTarget:self action:@selector(backButton:) forControlEvents:UIControlEventTouchUpInside];
        
        
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_titleLabel];
        
    }
    
    return self;
}

- (void)layoutSubviews {
    
    
    self.backButton.frame = CGRectMake(10, self.height - 40, 40, 30);
    
    self.titleLabel.frame = CGRectMake(self.width/2-80, self.height - 40, 160, 30);
    
}

- (void)backButton:(UIButton *)button {
    
    [self.delegate disMissController];
    
}

@end
